package com.own.util;

import java.lang.reflect.Field;

import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;

public class ResourceUtil {

	public static IModel getResource(Field field) {

		String resourceName = field.getDeclaringClass().getSimpleName() + "."
				+ field.getName();

		return new ResourceModel(resourceName, "$!" + resourceName + "!$");

	}

	public static IModel getResource(Class cls) {

		return new ResourceModel(cls.getSimpleName(), "$!"
				+ cls.getSimpleName() + "!$");

	}

	public static IModel getResource(Object obj) {

		return new ResourceModel(obj.getClass().getSimpleName(), "$!"
				+ obj.getClass().getSimpleName() + "!$");

	}
	public static IModel getResource(String str) {

		return new ResourceModel(str, "$!"
				+ str + "!$");

	}
	
	public static IModel getResourceString(String str) {

		return new ResourceModel(str, 
				 str  );

	}

}
